package com.supermarket.api.repository;

import com.supermarket.api.entity.OrderRecordEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

/**
 * 订单相关
 * @author 李其伟
 * @date 2023/11/11
 */
@Repository
public interface OrderRecordRepository extends JpaRepository<OrderRecordEntity, Long> {

    Page<OrderRecordEntity> findAllByUserIdAndDeleteStatusOrderByCreateTimeDesc(Long userId, Integer deleteStatus, Pageable pageable);

    Page<OrderRecordEntity> findAllByUserIdAndStatusAndDeleteStatusOrderByCreateTimeDesc(Long userId, Integer status, Integer deleteStatus, Pageable pageable);

    OrderRecordEntity findAllByOrderSnAndUserId(String orderSn, Long userId);
}
